<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增项目进度调度任务')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-process-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label"><span style="color: red; ">*</span>任务名称：</label>
                <div class="col-sm-8">
                    <input name="processName" class="form-control" type="text" required>
                </div>
            </div>
            <!--<div class="form-group">-->
                <!--<label  class="col-sm-3 control-label" ><span style="color: red; ">*</span>项目选择</label>-->
                <!--<div class="col-sm-8">-->
                <!--<select class="form-control" name="projectId">-->
                    <!--<option value="">&#45;&#45;请选择项目&#45;&#45;</option>-->
                    <!--<option th:each="project : ${projects}" th:value="${project.proId}" th:text="${project.proName}" ></option>-->
                <!--</select>-->
                <!--</div>-->
            <!--</div>-->

            <input type="hidden" name="projectIds" id="projectIds" />
            <div class="form-group">
                <label class="col-sm-3 control-label">任务类型：</label>
                <div class="col-sm-8">
                    <select name="taskType"  class="form-control m-b" th:with="type=${@dict.getType('task_type')}" required>
                        <option value="">所有</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">上报周期：</label>
                <div class="col-sm-8">
                    <select name="reportingCycle"  class="form-control m-b" required>
                        <option value="">所有</option>
                        <option value="0">临时</option>
                        <option value="1">月报</option>
                        <option value="2">季报</option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">有效开始日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="startDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">有效截至日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="endDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control"></textarea>
                </div>
            </div>
        </form>
        <h4 class="form-header h4" style="margin: 0px">项目选择</h4>
        <!--<div class="col-sm-12 search-collapse">-->
            <!--<form id="project-form">-->
                <!--<div class="select-list">-->
                    <!--<ul>-->
                        <!--<li>-->
                            <!--项目名称：<input type="text" name="loginName"/>-->
                        <!--</li>-->
                        <!--<li>-->
                            <!--<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>-->
                            <!--<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
                        <!--</li>-->
                    <!--</ul>-->
                <!--</div>-->
            <!--</form>-->
        <!--</div>-->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script type="text/javascript">
        var prefix = ctx + "linkong/process"

        $(function() {
            var options = {
                url: ctx + "linkong/project/list",
                modalName: "项目",
                showSearch: false,
                showPageGo: false,
                showRefresh: false,
                showColumns: false,
                showToggle:false,
                columns: [{
                    checkbox: true
                },
                    {
                        field : 'proId',
                        title : '项目ID',
                        visible: false
                    },
                    {
                        field : 'companyName',
                        align: 'center',
                        title : '企业名称'
                    },
                    {
                        field : 'proCode',
                        align: 'center',
                        title : '项目编码'
                    },
                    {
                        field : 'leader',
                        align: 'center',
                        title : '企业联系人'
                    },
                    {
                        field : 'leaderPhone',
                        title : '法人手机号',
                        align: 'center',
                        formatter : function (value) {
                            return value == null?"-":value.substr(0,3) + "****" + value.substr(7)
                        }
                    },
                ]
            };
            $.table.init(options);
        });
        $("#form-process-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            var rows = $.table.selectFirstColumns();
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一个企业");
                return;
            }
            $("#projectIds").val(rows.join());
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-process-add').serialize());
            }
        }

        $("input[name='startDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $("input[name='endDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

    </script>
</body>
</html>